-- @Author: 作者QQ2308873645
-- @Date:   2021-11-27 13:12:32
-- @Last Modified by:   作者QQ381990860
-- @Last Modified time: 2022-09-13 17:43:28
local 场景类_梦幻指引 = class()
local format = string.format
local min = math.min
local max = math.max
local ceil = math.ceil
local floor = math.floor

local tp,zts1,zts,zts2
local xxx = 0
local yyy = 0


local 积分={

	{"20","10","10","50","30","50","10","5","30","30","1"},
	{"1","1","1","1","1","1","0","1","0","1","1","1","1","1"},
	{"1","1","1","1","1","1","1","10","5","1","1"},
	{"100"},}


local 图标资源={}
local max = 1
local insert = table.insert
local mouseb = 引擎.鼠标弹起
 local _GUI   = require("ggeui/加载类")()
 local 控件界面 = _GUI:创建控件('控件界面')
local 渐进加载界面_进度条= 控件界面:创建进度('渐进加载界面_进度条',122+90,402+65,225,6)
function 渐进加载界面_进度条:初始化()
  self:置颜色(0xFF23d749)
  self.i = 1
end
function 场景类_梦幻指引:初始化(根)
	self.ID = 41
	self.x = 90+(全局游戏宽度-800)/2
	self.y = 65
	self.xx = 0
	self.yy = 0
	self.注释 = "梦幻指引"
	tp = 根

	zts = tp.字体表.华康字体
	zts1 = tp.字体表.抽奖字体
	zts2 = tp.字体表.抽奖字体一
		self.鼠标 = false
	self.焦点 = false
	self.可移动 = true
	local 资源 = 根.资源
	local 自适应 = 根._自适应
	local 按钮 = 根._按钮
	self.资源组 = {
		[1] = 根.资源:载入("签到背景.png","加密图片"),
		[2] =  自适应.创建(9,1,270,75,3,9),
		[3] =  {},
		[4] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",2),0,0,3),
		[5] =  按钮.创建(资源:载入('MAX.7z',"网易WDF动画",1),0,0,4,true,true,"每日活动"),
		[6] =  按钮.创建(资源:载入('MAX.7z',"网易WDF动画",1),0,0,4,true,true,"日常任务"),
		[7] = 按钮.创建(自适应.创建(20,4,18,19,4,3),0,0,4,true,true),
		[8] = 按钮.创建(自适应.创建(21,4,18,19,4,3),0,0,4,true,true),
		[11] = 根._滑块(自适应.创建(33,4,10,32,4,3,nil),4,10,199,2),
		[12] =  按钮.创建(资源:载入('MAX.7z',"网易WDF动画",1),0,0,4,true,true,"兑换充值点"),
		[13] =  按钮.创建(资源:载入('MAX.7z',"网易WDF动画",1),0,0,4,true,true,"副本任务"),
		[14] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",206),0,0,3),
		[15] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",208),0,0,3,true,true,"30"),
		[16] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",207),0,0,3),
		[17] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",204),0,0,3),
		[18] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",209),0,0,4),--1
		[19] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",209),0,0,4),--1
		[20] = 按钮.创建(根.资源:载入('MAX.7z',"网易WDF动画",209),0,0,4),--1
		[21] = 资源:载入('JM.dll',"网易WDF动画",0xE6490543),
		[22] = 资源:载入('JM.dll',"网易WDF动画",0x5FD1F401),
		[23] =  自适应.创建(9,1,70,20,3,9),
		[26] = 资源:载入('JM.dll',"网易WDF动画",0x3906F9F1),
	}


	for i=4,8 do
	   self.资源组[i]:绑定窗口_(41)
	end
	self.资源组[5]:置偏移(25,2)
	self.资源组[6]:置偏移(25,2)
	for i=12,13 do
	   self.资源组[i]:绑定窗口_(41)
	   self.资源组[i]:置偏移(25,2)
	end
	for i=14,20 do
	   self.资源组[i]:绑定窗口_(41)
	end
	self.资源组[15]:置偏移(25,6)
	self.状态 = 1
	self.子类状态 = 1
	self.窗口时间 = 0
   self.资源组[3]={}
end


function 场景类_梦幻指引:打开(数据)
	if self.可视 then
		self.可视 = false
		self.加入 = 0
		self.资源组[3]={}
	    self.状态 = 1
	   self.子类状态 = 1
	else

	   for i=1,4 do
	   	 self.资源组[3][i]={}
	   	 for n=1,#积分[i] do
	   	 	self.资源组[3][i][n]=tp._按钮.创建(tp.资源:载入('MAX.7z',"网易WDF动画",0),0,0,4,true,true,"攻略")

	   	 	self.资源组[3][i][n]:置偏移(12,2)
	   	 	self.资源组[3][i][n]:绑定窗口_(41)

	   	 end
	   end
     	self.资源组[15]:置文字(os.date("%d").."日")
		self.资源组[11]:置起始点(0)
		self.加入 = 0
        self.数据=数据
		tp.运行时间 = tp.运行时间 + 1
	    self.窗口时间 = tp.运行时间
	    self.可视 = true
	    insert(tp.窗口_,self)
	end
end

function 场景类_梦幻指引:显示(dt,x,y)
	self.资源组[4]:更新(x,y)
	self.资源组[12]:更新(x,y)
	tp.画线:置区域(0,0,15,250)
	   for i=1,4 do
	   	 for n=1,#积分[i] do
	   	 	self.资源组[3][i][n]:更新(x,y)
	   	 end
	   end
		self.资源组[7]:更新(x,y,self.加入 > 0)
		self.资源组[8]:更新(x,y,self.加入 < max - 6)
	for i=14,17 do
			self.资源组[i]:更新(x,y)
	end
	for i=18,20 do
			self.资源组[i]:更新(x,y,self.数据[1].获得活跃度>=400*(i-17))
	end
	if self.资源组[4]:事件判断() then
		self:打开()
		return false
	elseif self.资源组[7]:事件判断() then
		self.资源组[11]:置起始点(self.资源组[11]:取百分比转换(self.加入-2,6,#积分[self.状态]))
	elseif self.资源组[8]:事件判断() then
		self.资源组[11]:置起始点(self.资源组[11]:取百分比转换(self.加入+2,6,#积分[self.状态]))
	elseif self.资源组[18]:事件判断() then--葫芦
		客户端:发送数据(1, 22,5, "93")
	elseif self.资源组[19]:事件判断() then
		客户端:发送数据(2, 22,5, "93")
	elseif self.资源组[20]:事件判断() then
		客户端:发送数据(3, 22,5, "93")
	elseif self.资源组[15]:事件判断() then
     tp.提示:写入("#Y/功能还未开发!")
	elseif self.资源组[16]:事件判断() then
		   客户端:发送数据(1, 1, 43, "P7")
	elseif self.资源组[17]:事件判断() then
		   客户端:发送数据(1,1,14,"活跃度")
	elseif self.资源组[14]:事件判断() then
           客户端:发送数据(1, 1, 66, "P7")
	elseif self.资源组[12]:事件判断() then
           客户端:发送数据(1, 1, 134, "P7")
	end
	self.焦点 = false
	self.资源组[1]:显示(self.x,self.y)
	self.资源组[4]:显示(self.x+640,self.y)
		self.资源组[2]:置宽高(270,75)
		--self.资源组[12]:显示(self.x+500,self.y+36)

		self.资源组[14]:显示(self.x+45,self.y+372)
		self.资源组[15]:显示(self.x+470,self.y+395,true,1)
		self.资源组[16]:显示(self.x+550,self.y+395)
		self.资源组[17]:显示(self.x+600,self.y+395)
		zts:置颜色(0xFFFFFFFF):显示(self.x+475,self.y+435,"活动日历")
		zts:置颜色(0xFFFFFFFF):显示(self.x+552,self.y+435,"排行")
		zts:置颜色(0xFFFFFFFF):显示(self.x+602,self.y+435,"兑换")
		渐进加载界面_进度条:置位置(min(floor(self.数据[1].获得活跃度 / 1300*100)))
		--zts1:显示(self.x+70,self.y+40,"当前充值点：")
		--zts2:显示(self.x + 152,self.y + 40,self.数据[2].充值点)
		--zts1:显示(self.x+210,self.y+40,"(备注：充值点打怪获取，只有队长可以获得)")


		zts1:显示(self.x+60,self.y+90,"师门完成进度：")
		zts1:显示(self.x+60,self.y+120,"抓鬼完成进度：")
		zts1:显示(self.x+60,self.y+150,"鬼王完成进度：")
		zts1:显示(self.x+60,self.y+180,"知了活动进度：")
		zts1:显示(self.x+60,self.y+210,"门派闯关进度：")
		zts1:显示(self.x+60,self.y+240,"皇宫飞贼进度：")
		zts1:显示(self.x+60,self.y+270,"通天塔进度：")
		zts1:显示(self.x+60,self.y+300,"车迟副本进度：")
		zts1:显示(self.x+60,self.y+330,"乌鸡副本进度：")
		zts2:显示(self.x + 170,self.y + 90,self.数据[2].师门.."/20")
		zts2:显示(self.x + 170,self.y + 120,self.数据[2].抓鬼.."/200")
		zts2:显示(self.x + 170,self.y + 150,self.数据[2].鬼王.."/100")
		zts2:显示(self.x + 170,self.y + 180,self.数据[2].知了.."/50")
		zts2:显示(self.x + 170,self.y + 210,self.数据[2].门派闯关.."/5")
		zts2:显示(self.x + 170,self.y + 240,self.数据[2].皇宫飞贼.."/5")
		zts2:显示(self.x + 170,self.y + 270,self.数据[2].通天塔.."/20")
		zts2:显示(self.x + 170,self.y + 300,self.数据[2].车迟斗法.."/1")
		zts2:显示(self.x + 170,self.y + 330,self.数据[2].乌鸡国.."/1")


		zts1:显示(self.x+320,self.y+90,"任务链进度：")
		zts1:显示(self.x+320,self.y+120,"轮回镜进度：")
		zts1:显示(self.x+320,self.y+150,"新手泡泡进度：")
		zts1:显示(self.x+320,self.y+180,"夏日炎炎进度：")
		zts1:显示(self.x+320,self.y+210,"年兽活动进度：")
		zts1:显示(self.x+320,self.y+240,"地煞活动进度：")
		zts1:显示(self.x+320,self.y+270,"天罡神器进度：")
		zts1:显示(self.x+320,self.y+300,"玲珑宝图进度：")
		zts1:显示(self.x+320,self.y+330,"高级藏宝进度：")

		zts2:显示(self.x + 430,self.y + 90,self.数据[2].任务链.."/100")
		zts2:显示(self.x + 430,self.y + 120,self.数据[2].轮回镜.."/1")
		zts2:显示(self.x + 430,self.y + 150,self.数据[2].新手泡泡.."/50")
		zts2:显示(self.x + 430,self.y + 180,self.数据[2].夏日炎炎.."/50")
		zts2:显示(self.x + 430,self.y + 210,self.数据[2].年兽活动.."/50")
		zts2:显示(self.x + 430,self.y + 240,self.数据[2].地煞活动.."/10")
		zts2:显示(self.x + 430,self.y + 270,self.数据[2].天罡神器.."/10")
		zts2:显示(self.x + 430,self.y + 300,self.数据[2].玲珑宝图.."/20")
		zts2:显示(self.x + 430,self.y + 330,self.数据[2].高级藏宝图.."/20")

	  _GUI:更新(dt,x, y)
      _GUI:显示(x, y)
      控件界面:置可视(true, true)
      for i=1,3 do
		  	self.资源组[17+i]:显示(self.x+162+(i-1)*82,self.y+392)
		  	zts:置颜色(0xFFFFFFFF):显示(self.x+162+(i-1)*82,self.y+425,i*400)
	  end
      zts:置颜色(0xFFFFFFFF):显示(self.x+370,self.y+385,"今日活跃度")
      zts:置颜色(0xFFFFFFFF):显示(self.x+390,self.y+403,self.数据[1].获得活跃度)
      zts:置颜色(0xFFFFFFFF):显示(self.x+370,self.y+425,"累计活跃度")
      zts:置颜色(0xFFFFFFFF):显示(self.x+390,self.y+440,self.数据[1].活跃度)
end
function 场景类_梦幻指引:检查点(x,y)
   if self.可视 and self.资源组[1]:是否选中(x,y)  then
        return true
    else
        return false
    end
end

function 场景类_梦幻指引:初始移动(x,y)
    tp.运行时间 = tp.运行时间 + 1
    if not tp.消息栏焦点 then
        self.窗口时间 = tp.运行时间
    end
    if not self.焦点 then
        tp.移动窗口 = true
    end
    if self.鼠标 and  not self.焦点 then
        self.xx = x - self.x
        self.yy = y - self.y
    end
end

function 场景类_梦幻指引:开始移动(x,y)
    if self.鼠标 then
        self.x = x - self.xx
        self.y = y - self.yy
        渐进加载界面_进度条:_消息事件("窗口移动",self.x-90,self.y-65)
    end
end
return 场景类_梦幻指引